package cn.serein.charging.user.controller;

import cn.serein.charging.common.pojo.JsonResult;
import cn.serein.charging.common.pojo.vo.UserInfoVO;
import cn.serein.charging.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("user")
@Api(tags = "用户接口")
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @ApiOperation(value = "获取用户信息")
    @GetMapping("/info/{userId}")
    public JsonResult<String> getUserInfo(@PathVariable Integer userId) {
        log.debug("用户服务入参:{}" , userId);
        UserInfoVO userInfoVO = userService.getUserInfo(userId);


        log.debug("用户服务出参：{}" ,userInfoVO);
        return JsonResult.success(200, "success", userInfoVO);
    }
}
